Add page get --as raw and surface lossy rendering via render_notes#7
Merged
Merged
Conversation
`page get` rendered storage XHTML to markdown/text and silently dropped whatever it could not represent — macros without a native rendering (e.g. view-file), images degraded to a placeholder. There was no signal that content was lost and no way to retrieve the untouched source. The write direction already warns on lossy conversion (MarkdownToStorage); the read direction did not — an asymmetry. - `render.Render` now returns `Notes`: a parse-time tree scan (`lossNotes`) reports structured macros it does not natively render and images shown as placeholders. `page get` surfaces them as a `render_notes` output field. - `page get --as raw` emits the body source untouched (storage XHTML, or view HTML with --body-format view), skipping rendering entirely. It requires --scope full — slicing unparsed source is out of scope. The `--body-format` (source representation to fetch) vs `--as` (output form) split is kept; `--as` gains `raw` as the lossless option, completing that axis. Verified against a live Data Center instance: `page get <id> --as raw` shows the stored view-file macro; the default render now reports it in render_notes. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
A Coding Agent wrote a valid
view-filemacro to a page, butpage getrendered the body to markdown and silently dropped the macro — the agent
had no way to tell content was lost, and no way to retrieve the source.
A read-pipeline audit found two real inconsistencies:
(
MarkdownToStorage) warns on unsupported constructs; the read direction(
Render) had no signal at all — unknown macros dropped, images →[image].--as markdown|textboth transform; the rawstorage XHTML was unreachable.
Changes
render.RenderreportsNotes— a parse-time tree scan (lossNotes)names structured macros without a native rendering and placeholdered images.
page getsurfaces them as arender_notesoutput field. Rendering loss isno longer silent.
page get --as rawemits the body source untouched (storage XHTML, orview HTML with
--body-format view) — no rendering. Requires--scope full(slicing unparsed source is out of scope here).
The
--body-format(representation to fetch) vs--as(output form) axes arekept as-is;
--assimply gainsrawas its lossless value, completing the axis.Both additions are non-breaking (
render_notesisomitempty).Verification
gofmt/go vet/go test ./...green;make e2e44/44;make docsidempotent. New tests: render
Notesfor dropped macros/images;page get --as rawreturns source verbatim;--as raw --scope outlineis rejected.page get <id> --as rawreturns the stored<ac:structured-macro ac:name="view-file">(confirming the macro waswritten correctly); the default render reports it in
render_notes.Patch/minor material — additive only. Suggest v0.4.0.
🤖 Generated with Claude Code